<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>充值</title>
		<script src="js/mui.min.js"></script>
		<link href="css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="css/base.css" />
		<script src="js/flexible.js"></script>
		<link rel="stylesheet" href="css/chongzhi.css" />
		<script src="js/confi.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/jquery-3.1.1.js"></script>
		<script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
		<script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left" style="color: #000;"></a>
			<h1 class="mui-title">充值</h1>
			<a href="recharge-record.html" class="mui-icon mui-pull-right" style="font-size: 0.3rem;line-height: 30px;">充值记录</a>
		</header>
		<div style="background-color: #fff;margin-top: 60px;">
			<p style="margin: 0 0.3rem;color: #000;">金币充值：<span>100</span>金币等于<span>100</span>元</p>
			<div style="width: 100%;height: 5rem;padding: 0.3rem 0;" id="qian">

			</div>
		</div>
		<!--<form action="http://cherry.guojinkj123.com/home/User/dorecharge"  method="post">
			<input id="pay_memberid" type="hidden" name="pay_memberid" value="" />
			<input id="pay_orderid" type="hidden" name="pay_orderid" value="" />
			<input id="pay_amount" type="hidden" name="pay_amount" value="" />
			<input id="pay_applydate" type="hidden" name="pay_applydate" value="" />
			<input id="pay_bankcode" type="hidden" name="pay_bankcode" value="" />
			<input id="pay_notifyurl" type="hidden" name="pay_notifyurl" value="" />
			<input id="pay_callbackurl" type="hidden" name="pay_callbackurl" value="" />
			<input id="pay_md5sign" type="hidden" name="pay_md5sign" value="" />
			<input id="pay_productname" type="hidden" name="pay_productname" value="" />
			<button style="width: 80%;margin: auto;" type="submit" class="mui-btn mui-btn-primary mui-btn-block" id="btn">确认充值</button>
		</form>-->
		
		<button style="width: 80%;margin: auto;" type="submit" class="mui-btn mui-btn-primary mui-btn-block" id="btn">确认充值</button>
		<script type="text/javascript" charset="utf-8">
			mui.init();
			var token = localStorage.getItem('token');
			//获取充值金额列表
			mui.ajax(config.host + '/home/User/chargeMoney', {
				headers: {
					'token': token
				},
				dataType: 'json', //服务器返回json格式数据
				type: 'get', //HTTP请求类型	              
				success: function(data) {
					if(data.code == 200) {
						data.data.map(function(item, index) {
							if(index == 0) {
								$('#qian').append("<span class='yangshi aaa'>" + item + "</span>");
								$('#pay_amount').val(item);	
								pay();
							} else {
								$('#qian').append("<span class='yangshi'>" + item + "</span>");
							}
						})
					} else {
						mui.toast(data.msg)
					}
				}
			});
			function pay(){
				mui.ajax(config.host + '/home/User/chargeMoney', {
					headers: {
						'token': token
					},
					dataType: 'json', //服务器返回json格式数据
					type: 'post', //HTTP请求类型	              
					data: {
						'price': $('#pay_amount').val()
					},
					success: function(data) {
						if(data.code==200){
							$('#pay_applydate').val(data.data.pay_applydate);
							$('#pay_bankcode').val(data.data.pay_bankcode);
							$('#pay_callbackurl').val(data.data.pay_callbackurl);
							$('#pay_md5sign').val(data.data.pay_md5sign);
							$('#pay_memberid').val(data.data.pay_memberid);
							$('#pay_notifyurl').val(data.data.pay_notifyurl);
							$('#pay_orderid').val(data.data.pay_orderid);
							$('#pay_productname').val(data.data.pay_productname);
						}
					}
				})
			}
			$("#qian").on('click', '.yangshi', function() {
				$(this).addClass('aaa').siblings().removeClass('aaa');
				$('#pay_amount').val($(this).text());''
				pay();
			})
			//充值
			$('#btn').on('tap', function() {
				mui.ajax(config.host + '/home/User/dorecharge', {
					headers: {
						'token': token
					},
					dataType: 'json', //服务器返回json格式数据
					type: 'post', //HTTP请求类型	              
					data: {
						'money': 0.01
					},
					success: function(data) {
						if(data.code==200){
							/*$('#pay_applydate').val(data.data.pay_applydate);
							$('#pay_bankcode').val(data.data.pay_bankcode);
							$('#pay_callbackurl').val(data.data.pay_callbackurl);
							$('#pay_md5sign').val(data.data.pay_md5sign);
							$('#pay_memberid').val(data.data.pay_memberid);
							$('#pay_notifyurl').val(data.data.pay_notifyurl);
							$('#pay_orderid').val(data.data.pay_orderid);
							$('#pay_productname').val(data.data.pay_productname);*/
							$("#btn").prepend(data.data.res);
						}
					}
				})
			})
		</script>
		<script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
		<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
	</body>

</html>